<?php
/**
* 退货单
*
* @copyright shopex.cn 2015.05.07
* @author sunjing<sunjing@shopex.cn>
*/
class middleware_wms_matrixwms_request_qimen_reship extends middleware_wms_matrixwms_request_reship{

    public function reship_cancel(&$sdf,$sync=false){
        
        $reship_bn = $sdf['reship_bn'];

        $params = array(
            'order_type'     => 'OUT_OTHER',
            'out_order_code' => $reship_bn,
            'warehouse_code' => $this->getWarehouse_code($sdf['branch_bn']),
        );

        $writelog = array(
            'log_title'   => '退货单取消',
            'log_type'    => 'store.trade.reship',
            'original_bn' => $reship_bn,
        );
        
        $method = 'store.wms.order.cancel';
        return $this->request($method,$params,$writelog,$sync);
    }

    protected function _getReship_create_params($sdf)
    {
        $params = parent::_getReship_create_params($sdf);
        $params['warehouse_code'] = $this->getWarehouse_code($sdf['branch_bn']);

        switch ($sdf['return_type']) {
            case 'return':
                $params['order_type'] = 'THRK'; // 退货入库
                break;
            case 'change':
                $params['order_type'] = 'HHRK'; // 换货入库 
                break;
            default:
                $params['order_type'] = '';
                break;
        }

        return $params;
    }
}